package com.luozongyao.statistics.controller;


import com.luozongyao.commons.R;
import com.luozongyao.statistics.service.UserService;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;

/**
 * <p>
 *  前端控制器
 * </p>
 *
 * @author luozongyao
 * @since 2021-10-25
 */
@Api(description="统计用户信息管理")
@RestController
@RequestMapping("/statistics/user")
@CrossOrigin
public class UserController {

    @Autowired
    private UserService userService;

    //图表显示，返回两部分数据，日期json数组，数量json数组
//    @GetMapping("show-chart/user/{begin}/{end}")
//    public R showChart(@PathVariable String begin, @PathVariable String end){
//        Map<String, Object> map = userService.getChartData(begin,end);
//        return R.ok().data(map);
//    }
    //统计某天用户注册人数
    @ApiOperation(value = "统计某天用户注册人数")
    @GetMapping("registerCount/{day}")
    public R registerCount(@PathVariable String day){
        Integer count  =  userService.registerCount(day);
        return R.ok().data("registerCount",count);
    }


}

